import {BasicApi} from "@/common/BasicApi.ts";
import {CarBo, CarSearchBo, CarVo} from "@/dto/Car/Car.ts";
import axiosRequest from "@/config/axios.ts";
import Result from "@/common/Result.ts";
import SelectVo from "@/common/SelectVo.ts";
import PageVo from "@/common/PageVo.ts";

class CarApi implements BasicApi<CarVo, CarBo, CarSearchBo> {
    async listAll(sb: CarSearchBo): Promise<Result<Array<CarVo>>> {
        return await axiosRequest.post<CarSearchBo,Result<Array<CarVo>>>("/car/list_all",sb);
    }

    async deleted(sb: CarSearchBo): Promise<Result<CarVo>> {
        return await axiosRequest.post<CarSearchBo,Result<CarVo>>("/car/deleted",sb);
    }

    async deletedAll(sbList: Array<CarSearchBo>): Promise<Result<Array<CarVo>>> {
        return await axiosRequest.post<Array<CarSearchBo>,Result<Array<CarVo>>>("/car/deleted_all",sbList);
    }

    async edit(b: CarBo): Promise<Result<CarVo>> {
        return await axiosRequest.post<CarBo,Result<CarVo>>("/car/edit",b);
    }

    async editAll(bList: Array<CarBo>): Promise<Result<Array<CarVo>>> {
        return await axiosRequest.post<CarBo,Result<Array<CarVo>>>("/car/edit_all",bList);
    }

    async get(sb: CarSearchBo): Promise<Result<CarVo>> {
        return await axiosRequest.post<CarSearchBo,Result<CarVo>>("/car/get",sb);
    }

    async option(): Promise<Result<Array<SelectVo<string, number, CarVo>>>> {
        return await axiosRequest.post<CarSearchBo,Result<Array<SelectVo<string, number, CarVo>>>>("/car/option");
    }

    async pageAll(sb: CarSearchBo): Promise<Result<PageVo<CarVo>>> {
        return await axiosRequest.post<CarSearchBo,Result<PageVo<CarVo>>>("/car/page_all",sb);
    }

}

export default CarApi;